package admin.controller;

import admin.common.convention.result.Result;
import admin.common.convention.result.Results;
import admin.common.enums.UserErroeCodeEnum;
import admin.dao.entity.UserDo;
import admin.dto.resp.UserRespDto;
import admin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能：
 * 作者：张赛特
 * 日期：2025/8/8 18:04
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService;
    /**
     * 根据用户名查询信息
     * @param username
     * @return
     */
    @GetMapping("/api/shortlink/v1/user/{username}")
    public Result<UserRespDto> getUserByUsername(@PathVariable("username") String username){
        UserRespDto resule=userService.getUserByUsername(username);
//        if (resule==null){
//            return Results.failure(UserErroeCodeEnum.USER_NULL);
//        }else{
            return Results.success(resule);


    }
}